import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: GaoBo
 * Date: 2021-04-23
 * Time: 17:56
 */

class Test {
    public static int i;
    public void func() {
        //static int b = 10;
        System.out.println("普通方法func()");
    }
    //  static 定义的变量 一定是只有1份的。所以 你可以看做他是"全局"的
    public static void hello() {
        //static int b = 99;
        System.out.println("hello()!!");
    }

}
class A {

    /**
     * this()
     * this.func()
     * this.data
     */
    public A() {
        this(10);
    }

    public A(int a) {

    }

}
public class TestDemo {

    public static void swap(int[] array1,int [] array2) {
        //换一部分
        if(array1.length > array2.length) {
            for (int i = 0; i < array2.length; i++) {
                int tmp = array1[i];
                array1[i] = array2[i];
                array2[i] = tmp;
            }
        }else {
            for (int i = 0; i < array1.length; i++) {
                int tmp = array1[i];
                array1[i] = array2[i];
                array2[i] = tmp;
            }
        }

    }

    public static void swap2(int[] array1,int [] array2) {
        int[] tmp = array1;
        array1 = array2;
        array2 = tmp;
    }

    public static void swap3(int[][] array) {
        int[] tmp = array[0];
        array[0] = array[1];
        array[1] = tmp;
    }

    public static void main(String[] args) {
        int[] array1 = {1,2,3,4,5,11,12,13,14,15,16};
        int[] array2 = {6,7,8,9,10};

        //swap(array1,array2);
        int[][] array = {array1,array2};
        System.out.println("交换前："+ Arrays.toString(array[0]));
        System.out.println("交换前："+ Arrays.toString(array[1]));
        swap3(array);
        System.out.println("交换后："+ Arrays.toString(array[0]));
        System.out.println("交换后："+ Arrays.toString(array[1]));
    }



    static boolean flg;
    public int a = 10;
    int c;
    public static void main2(String[] args) {
        System.out.println(TestDemo.flg);

        /*String s;
        System.out.println(s);//编译时期错误
*/
       /* TestDemo testDemo = new TestDemo();
        System.out.println(testDemo.str);*/

    }
    public static void main1(String[] args) {
        Test test1 = null;//test1不指向任何对象
        test1.hello();

        Test test = new Test();
        test.hello();

      /*  Test.hello();

        Test test = new Test();
        test.func();*/
    }
}
